package app1

import (
	"fmt"
	"log"
	"net/http"
)

func App1() {

	http.HandleFunc("/hello", handler)
	// https是浏览器支持的，我们只要提供我们的证书，就可以了
	err := http.ListenAndServe(":8081", nil)
	if err != nil {
		log.Fatal("ListenerAndServe:", err)
	}
}
func handler(res http.ResponseWriter, rq *http.Request) {
	fmt.Println(rq)
	// 判断请求方法类型
	fmt.Println(rq.Method)
	writeLen, _ := res.Write([]byte("I have receive the request,你访问的是黎勇的云服务器，欢迎常来光顾"))
	fmt.Println("write len:", writeLen)
}
